/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * Utama.java
 *
 * Created on Nov 9, 2011, 12:29:35 PM
 */
package Utama;

import Kasir.MencatatTransaksi;
import Manager.Laporan;
import Manager.Login.CekPassword;
import Manager.Update.UpdateStock;
import java.awt.BorderLayout;

/**
 *
 * @author Piyo
 */
public class Utama extends javax.swing.JFrame {

    /** Creates new form Utama */
    public Utama() {
        
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        mencatatTransaksi = new Kasir.MencatatTransaksi();
        laporan = new Manager.Laporan();
        updateStock = new Manager.Update.UpdateStock();
        jDesktopPane1 = new javax.swing.JDesktopPane();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jMenuBar1 = new javax.swing.JMenuBar();
        KasirMenu = new javax.swing.JMenu();
        MencatatTransaksiitem = new javax.swing.JMenuItem();
        jSeparator1 = new javax.swing.JPopupMenu.Separator();
        ExitMenuitem = new javax.swing.JMenuItem();
        jMenu2 = new javax.swing.JMenu();
        updateMenuItem = new javax.swing.JMenuItem();
        Laporanitem = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jDesktopPane1.setBackground(new java.awt.Color(255, 255, 255));

        jLabel1.setFont(new java.awt.Font("Comic Sans MS", 1, 24)); // NOI18N
        jLabel1.setText("Agatha Mini Market");
        jLabel1.setBounds(80, 130, 260, 34);
        jDesktopPane1.add(jLabel1, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gambar/leaf_banner_gray.png"))); // NOI18N
        jLabel2.setText("jLabel2");
        jLabel2.setBounds(0, 170, 420, 130);
        jDesktopPane1.add(jLabel2, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gambar/leaf_banner_gray.png"))); // NOI18N
        jLabel3.setText("jLabel2");
        jLabel3.setBounds(0, 0, 420, 130);
        jDesktopPane1.add(jLabel3, javax.swing.JLayeredPane.DEFAULT_LAYER);

        KasirMenu.setText("Kasir");

        MencatatTransaksiitem.setText("Mencatat Transaksi");
        MencatatTransaksiitem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                MencatatTransaksiitemActionPerformed(evt);
            }
        });
        KasirMenu.add(MencatatTransaksiitem);
        KasirMenu.add(jSeparator1);

        ExitMenuitem.setText("Exit");
        ExitMenuitem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ExitMenuitemActionPerformed(evt);
            }
        });
        KasirMenu.add(ExitMenuitem);

        jMenuBar1.add(KasirMenu);

        jMenu2.setText("Manager");

        updateMenuItem.setText("Update Stock");
        updateMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                updateMenuItemActionPerformed(evt);
            }
        });
        jMenu2.add(updateMenuItem);

        Laporanitem.setText("Laporan");
        Laporanitem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                LaporanitemActionPerformed(evt);
            }
        });
        jMenu2.add(Laporanitem);

        jMenuBar1.add(jMenu2);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jDesktopPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 424, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jDesktopPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 279, Short.MAX_VALUE)
        );

        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        setBounds((screenSize.width-440)/2, (screenSize.height-338)/2, 440, 338);
    }// </editor-fold>//GEN-END:initComponents

private void updateMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_updateMenuItemActionPerformed
    new CekPassword(this, true).setVisible(true);
    if (this.st) {
        this.jDesktopPane1.removeAll();
        this.jDesktopPane1.setLayout(new BorderLayout());
        this.updateStock = new UpdateStock();
        this.jDesktopPane1.add(this.updateStock, BorderLayout.CENTER);
        int height = this.updateStock.getPreferredSize().height + 53;
        int width = this.updateStock.getPreferredSize().width;
        this.setSize(width, height);
        this.jDesktopPane1.setVisible(false);
        this.jDesktopPane1.setVisible(true);
    }

}//GEN-LAST:event_updateMenuItemActionPerformed

private void MencatatTransaksiitemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MencatatTransaksiitemActionPerformed
    this.jDesktopPane1.removeAll();
    this.jDesktopPane1.setLayout(new BorderLayout());
    this.mencatatTransaksi = new MencatatTransaksi();
    this.jDesktopPane1.add(this.mencatatTransaksi, BorderLayout.CENTER);
    int height = this.mencatatTransaksi.getPreferredSize().height + 58;
    int width = this.mencatatTransaksi.getPreferredSize().width + 15;
    this.setSize(width, height);
    this.setLocation(350, 150);
    this.jDesktopPane1.setVisible(false);
    this.jDesktopPane1.setVisible(true);
}//GEN-LAST:event_MencatatTransaksiitemActionPerformed

private void LaporanitemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_LaporanitemActionPerformed
    new CekPassword(this, true).setVisible(true);
    if (this.st) {
        this.jDesktopPane1.removeAll();
        this.jDesktopPane1.setLayout(new BorderLayout());
        this.laporan = new Laporan();
        this.jDesktopPane1.add(this.laporan, BorderLayout.CENTER);
        int height = this.laporan.getPreferredSize().height + 53;
        int width = this.laporan.getPreferredSize().width;
        this.setSize(width, height);
        this.jDesktopPane1.setVisible(false);
        this.jDesktopPane1.setVisible(true);
    }

}//GEN-LAST:event_LaporanitemActionPerformed

private void ExitMenuitemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ExitMenuitemActionPerformed
    this.dispose();
}//GEN-LAST:event_ExitMenuitemActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(Utama.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(Utama.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(Utama.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(Utama.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {

            @Override
            public void run() {
                new Utama().setVisible(true);
                
            }
        });
    }
    private boolean st;
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenuItem ExitMenuitem;
    private javax.swing.JMenu KasirMenu;
    private javax.swing.JMenuItem Laporanitem;
    private javax.swing.JMenuItem MencatatTransaksiitem;
    private javax.swing.JDesktopPane jDesktopPane1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JPopupMenu.Separator jSeparator1;
    private Manager.Laporan laporan;
    private Kasir.MencatatTransaksi mencatatTransaksi;
    private javax.swing.JMenuItem updateMenuItem;
    private Manager.Update.UpdateStock updateStock;
    // End of variables declaration//GEN-END:variables

    /**
     * @param st the st to set
     */
    public void setSt(boolean st) {
        this.st = st;
    }
}
